package daohibernate;

import hibernate.HibernateUtil;
import negocio.beans.oficinaventa.Marca;

import org.hibernate.Session;
import org.hibernate.SessionFactory;

public class MarcaDAO {
	private static MarcaDAO instancia = null;
	private static SessionFactory sf = null;
	
	
	public static MarcaDAO getInstancia(){
		if(instancia == null){
			sf = HibernateUtil.getSessionFactory();
			instancia = new MarcaDAO();
		} 
		return instancia;
	}	
	
	public void grabarMarca(Marca m){
		Session s = sf.openSession();
		s.beginTransaction();	
		
		s.persist(m);
				
		s.flush();
		s.getTransaction().commit();
	}
}
